define(['../data/pm25'
  , '../data/geoCoordMap'
  , '../option/geo'
  , '../option/geo-hot'
  , '../data/province'
  , 'lodash'], function(pm25, geoCoordMap, geo, option, hot, _) {

  var convertData = function (data) {
      var res = [];
      for (var i = 0; i < data.length; i++) {
          var geoCoord = geoCoordMap[data[i].name];
          if (geoCoord) {
              res.push({
                  name: data[i].name,
                  value: geoCoord.concat(data[i].value)
              });
          }
      }
      return res;
  };

  var option = _.merge({}, option, {
    geo: geo,
    series: [{
      name: 'hot',
      type: 'map',
      mapType: 'china',
      geoIndex: 0,
      roam: false,
      showLegendSymbol: false,
      itemStyle: {
        normal: {
          borderWidth: 1,
          borderColor: '#c0e4f5'
        },
        emphasis: {
          areaColor: '#3448e0',
          borderWidth: 0
        }
      },
      label: {
        normal: {
          show: false,
          textStyle: {
            color: '#0facdb',
            fontSize: 12,
            opacity: 1
          }
        },
        emphasis: {
          textStyle: {
            color: '#fff'
          }
        }
      },
      data: hot.data
    }, {
      name: 'pm2.5',
      type: 'effectScatter',
      coordinateSystem: 'geo',
      rippleEffect: {
        scale: 20,
        period: 2,
        brushType: 'stroke'
      },
      data: convertData(pm25.data),
      symbol: 'rect',
      symbolSize: 2,
      label: {
        normal: {
          show: false
        },
        emphasis: {
          show: false
        }
      },
      itemStyle: {
        normal: {
          color: '#fff',
          opacity: 1
        },
        emphasis: {
          opacity: 0,
          borderColor: '#fff',
          borderWidth: 1
        }
      }
    }]
  })


  return option;
})